Chapter 11 Map volcanoes
Load the dataset
## Rows: 1608 Columns: 11
## ── Column specification ─────────────────────────────────────────────
## Delimiter: "\t"
## chr (7): Search Parameters, Volcano Name, Country, Location, Type, Status, L...
## dbl (4): Volcano Number, Latitude, Longitude, Elevation (m)
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## # A tibble: 5 × 11
## `Search Parameters` `Volcano Number` `Volcano Name` Country Location Latitude
## <chr> <dbl> <chr> <chr> <chr> <dbl>
## 1 [] NA <NA> <NA> <NA> NA
## 2 <NA> 250010 St. Andrew Str… Papua … Admiral… -2.38
## 3 <NA> 250020 Baluan United… Admiral… -2.57
## 4 <NA> 250030 Central Bismar… United… Admiral… -3.03
## 5 <NA> NA Dacht-I-Navar … Afghan… Afghani… 34.0
## # ℹ 5 more variables: Longitude <dbl>, `Elevation (m)` <dbl>, Type <chr>,
## # Status <chr>, `Last Known Eruption` <chr>
Map the volcanoes
volcanoes |>
leaflet() |>
addTiles() |>
addMarkers(lat = ~Latitude,
lng = ~Longitude,
label = ~`Volcano Name`)Cluster markers
volcanoes |>
leaflet() |>
addTiles() |>
addMarkers(lat = ~Latitude,
lng = ~Longitude,
label = ~`Volcano Name`,
clusterOptions = markerClusterOptions())volcanoes |>
leaflet() |>
addTiles() |>
addCircles(lat = ~Latitude,
lng = ~Longitude,
label = ~`Volcano Name`,
radius = 15000,
color = "red",
weight = 1,
fillOpacity = 0.8)Map alcohol consumption with leaflet
Load India data from a shapefile
## Reading layer `Indian_States' from data source
## `C:\GitHub\opengisci\wt25_josephholler\data_public\indiashp\Indian_States.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 36 features and 1 field
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 68.18625 ymin: 6.755953 xmax: 97.41529 ymax: 37.07827
## CRS: NA
